package com.ysqcould.mp.service.impl;

import java.util.List;

import com.ysqcould.common.core.domain.AjaxResult;
import com.ysqcould.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ysqcould.mp.mapper.ConpayInfoMapper;
import com.ysqcould.mp.domain.ConpayInfo;
import com.ysqcould.mp.service.IConpayInfoService;

import static com.ysqcould.mp.utils.CollectCpInfoUtils.getCpInfo;

/**
 * 企业信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-10-19
 */
@Service
public class ConpayInfoServiceImpl implements IConpayInfoService 
{
    @Autowired
    private ConpayInfoMapper conpayInfoMapper;

    /**
     * 查询企业信息
     * 
     * @param id 企业信息主键
     * @return 企业信息
     */
    @Override
    public ConpayInfo selectConpayInfoById(Long id)
    {
        return conpayInfoMapper.selectConpayInfoById(id);
    }

    /**
     * 查询企业信息列表
     * 
     * @param conpayInfo 企业信息
     * @return 企业信息
     */
    @Override
    public List<ConpayInfo> selectConpayInfoList(ConpayInfo conpayInfo)
    {
        return conpayInfoMapper.selectConpayInfoList(conpayInfo);
    }

    /**
     * 新增企业信息
     * 
     * @param conpayInfo 企业信息
     * @return 结果
     */
    @Override
    public int insertConpayInfo(ConpayInfo conpayInfo)
    {
        conpayInfo.setCreateTime(DateUtils.getNowDate());
        AjaxResult cpInfo = getCpInfo(conpayInfo.getcName());
        System.out.println(cpInfo);
        return conpayInfoMapper.insertConpayInfo(conpayInfo);
    }

    /**
     * 修改企业信息
     * 
     * @param conpayInfo 企业信息
     * @return 结果
     */
    @Override
    public int updateConpayInfo(ConpayInfo conpayInfo)
    {
        conpayInfo.setUpdateTime(DateUtils.getNowDate());
        return conpayInfoMapper.updateConpayInfo(conpayInfo);
    }

    /**
     * 批量删除企业信息
     * 
     * @param ids 需要删除的企业信息主键
     * @return 结果
     */
    @Override
    public int deleteConpayInfoByIds(Long[] ids)
    {
        return conpayInfoMapper.deleteConpayInfoByIds(ids);
    }

    /**
     * 删除企业信息信息
     * 
     * @param id 企业信息主键
     * @return 结果
     */
    @Override
    public int deleteConpayInfoById(Long id)
    {
        return conpayInfoMapper.deleteConpayInfoById(id);
    }
}
